ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
freemaster_defcfg.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 *
00003 * Freescale Semiconductor Inc.
00004 * (c) Copyright 2004-2011 Freescale Semiconductor
00005 * ALL RIGHTS RESERVED.
00006 *
00007 ****************************************************************************/
00019 #ifndef __FREEMASTER_DEFCFG_H
00020 #define __FREEMASTER_DEFCFG_H
00021 
00022 /* Read user configuration */
00023 #include "freemaster_cfg.h"
00024 
00025 /******************************************************************************
00026 * Configuration check 
00027 ******************************************************************************/
00028 
00029 /* polling mode as default when nothing selected */
00030 #if !defined(FMSTR_POLL_DRIVEN) && !defined(FMSTR_LONG_INTR) && !defined(FMSTR_SHORT_INTR)
00031     #define FMSTR_LONG_INTR   0
00032     #define FMSTR_SHORT_INTR  0
00033     #define FMSTR_POLL_DRIVEN 1
00034 #endif
00035 
00036 /* otherwise, "undefined" means false for all three options */
00037 #ifndef FMSTR_POLL_DRIVEN
00038 #define FMSTR_POLL_DRIVEN 0
00039 #endif
00040 #ifndef FMSTR_LONG_INTR
00041 #define FMSTR_LONG_INTR 0
00042 #endif
00043 #ifndef FMSTR_SHORT_INTR
00044 #define FMSTR_SHORT_INTR 0
00045 #endif
00046 
00047 
00048 #if FMSTR_SHORT_INTR
00049     /* default short-interrupt FIFO size */
00050     #ifndef FMSTR_COMM_RQUEUE_SIZE
00051     #define FMSTR_COMM_RQUEUE_SIZE 32
00052     #endif
00053 
00054     #if !FMSTR_COMM_RQUEUE_SIZE
00055     #undef  FMSTR_COMM_RQUEUE_SIZE
00056     #define FMSTR_COMM_RQUEUE_SIZE 32
00057     #endif
00058 #endif
00059 
00060 /* select JTAG, SCI or CAN interface */
00061 /* one of these is typically already enabled in freemaster_cfg.h */
00062 #ifndef FMSTR_USE_JTAG
00063 #define FMSTR_USE_JTAG 0
00064 #endif
00065 
00066 #ifndef FMSTR_USE_MSCAN
00067     #define FMSTR_USE_MSCAN 0
00068 #endif
00069 
00070 #ifndef FMSTR_USE_FLEXCAN
00071     #define FMSTR_USE_FLEXCAN 0
00072 #endif
00073 
00074 #ifndef FMSTR_USE_CAN
00075     #if ((FMSTR_USE_MSCAN) || (FMSTR_USE_FLEXCAN))
00076     #define FMSTR_USE_CAN 1
00077     #else
00078     #define FMSTR_USE_CAN 0
00079     #endif
00080 #endif
00081 
00082 #ifndef FMSTR_USE_MQX_IO
00083     #define FMSTR_USE_MQX_IO 0
00084 #endif
00085 
00086 #ifndef FMSTR_USE_USB_CDC
00087     #define FMSTR_USE_USB_CDC 0
00088 #endif
00089 
00090 #ifndef FMSTR_USE_PDBDM
00091     #define FMSTR_USE_PDBDM 0
00092 #endif
00093 
00094 #ifndef FMSTR_DISABLE
00095     #define FMSTR_DISABLE 0
00096 #endif
00097 
00098 /* SCI used by default if BASE address is provided */
00099 #ifndef FMSTR_USE_SCI
00100     #if defined(FMSTR_SCI_BASE) && !FMSTR_USE_JTAG && !FMSTR_USE_CAN && !FMSTR_USE_MQX_IO && !FMSTR_USE_USB_CDC && !FMSTR_DISABLE && !FMSTR_USE_PDBDM
00101     #define FMSTR_USE_SCI 1
00102     #else
00103     #define FMSTR_USE_SCI 0
00104     #endif
00105 #endif
00106 
00107 /* SCI does not have a transmission double buffer (kind of queue) */
00108 /* (if not specified differently in platform-dependent header file) */
00109 #if FMSTR_USE_SCI
00110     #ifndef FMSTR_SCI_HAS_TXQUEUE
00111     #define FMSTR_SCI_HAS_TXQUEUE 0
00112     #endif
00113 #endif
00114 
00115 /* CAN is MSCAN or FLEXCAN */
00116 #if FMSTR_USE_CAN
00117 
00118     /* CAN-related constants */
00119     #ifdef FMSTR_CAN_EXTID 
00120         #if FMSTR_CAN_EXTID != 0x80000000U
00121             #error FMSTR_CAN_EXTID must be defined as 0x80000000
00122             #undef FMSTR_CAN_EXTID 
00123         #endif
00124     #endif
00125 
00126     #ifndef FMSTR_CAN_EXTID
00127         #define FMSTR_CAN_EXTID 0x80000000U
00128     #endif
00129 
00130     /* flexcan needs to know the transmit and receive MB number */
00131     #if FMSTR_USE_FLEXCAN
00132         /* Flexcan TX message buffer must be defined */
00133         #ifndef FMSTR_FLEXCAN_TXMB
00134         //#error FlexCAN transmit buffer needs to be specified (use FMSTR_FLEXCAN_TXMB)
00135         #warning "FlexCAN Message Buffer 0 is used for transmitting messages"
00136         #define FMSTR_FLEXCAN_TXMB 0
00137         #endif
00138         /* Flexcan RX message buffer must be defined */
00139         #ifndef FMSTR_FLEXCAN_RXMB
00140         //#error FlexCAN receive buffer needs to be specified (use FMSTR_FLEXCAN_RXMB)
00141         #warning "FlexCAN Message Buffer 1 is used for receiving messages"
00142         #define FMSTR_FLEXCAN_RXMB 1
00143         #endif
00144     #endif
00145   
00146     /* incoming (command) CAN message ID */
00147     #ifndef FMSTR_CAN_CMDID
00148     #define FMSTR_CAN_CMDID 0x7aa
00149     #endif
00150 
00151     /* command ID can be changed in runtime (before FMSTR_Init) */
00152     #ifndef FMSTR_CAN_CMDID_DYNAMIC
00153     #define FMSTR_CAN_CMDID_DYNAMIC 0  /* disabled by default */
00154     #endif
00155     
00156     /* response CAN message ID, may be the same as command ID */
00157     #ifndef FMSTR_CAN_RESPID
00158     #define FMSTR_CAN_RESPID 0x7aa
00159     #endif
00160     
00161     /* response ID can be changed in runtime (before FMSTR_Init) */
00162     #ifndef FMSTR_CAN_RESPID_DYNAMIC
00163     #define FMSTR_CAN_RESPID_DYNAMIC 0  /* disabled by default */
00164     #endif
00165 
00166 #endif
00167 
00168 #if FMSTR_USE_USB_CDC
00169     #ifndef FMSTR_USB_CDC_ID
00170     #define  FMSTR_USB_CDC_ID      (0)   /* ID to identify USB CONTROLLER used by FreeMASTER */ 
00171     #endif
00172 #endif
00173 
00174 /* read memory commands are ENABLED by default */
00175 #ifndef FMSTR_USE_READMEM
00176 #define FMSTR_USE_READMEM 1
00177 #endif
00178 #ifndef FMSTR_USE_WRITEMEM
00179 #define FMSTR_USE_WRITEMEM 1
00180 #endif
00181 #ifndef FMSTR_USE_WRITEMEMMASK 
00182 #define FMSTR_USE_WRITEMEMMASK 1
00183 #endif
00184 
00185 /* read variable commands are DISABLED by default */
00186 #ifndef FMSTR_USE_READVAR
00187 #define FMSTR_USE_READVAR 0
00188 #endif
00189 #ifndef FMSTR_USE_WRITEVAR
00190 #define FMSTR_USE_WRITEVAR 0
00191 #endif
00192 #ifndef FMSTR_USE_WRITEVARMASK 
00193 #define FMSTR_USE_WRITEVARMASK 0
00194 #endif
00195 
00196 /* default scope settings */
00197 #ifndef FMSTR_USE_SCOPE
00198 #define FMSTR_USE_SCOPE 0
00199 #endif
00200 
00201 #ifndef FMSTR_MAX_SCOPE_VARS
00202 #define FMSTR_MAX_SCOPE_VARS 8
00203 #endif
00204 /* default recorder settings */
00205 #ifndef FMSTR_USE_RECORDER
00206 #define FMSTR_USE_RECORDER 0
00207 #endif
00208 
00209 #ifndef FMSTR_MAX_REC_VARS
00210 #define FMSTR_MAX_REC_VARS 8
00211 #endif
00212 
00213 #ifndef FMSTR_REC_FARBUFF
00214 #define FMSTR_REC_FARBUFF 0
00215 #endif
00216 
00217 #ifndef FMSTR_REC_OWNBUFF
00218 #define FMSTR_REC_OWNBUFF 0
00219 #endif
00220 
00221 #ifndef FMSTR_USE_FASTREC
00222 #define FMSTR_USE_FASTREC 0
00223 #endif
00224 
00225 /* Enable code size optimalization */
00226 #ifndef FMSTR_LIGHT_VERSION
00227 #define FMSTR_LIGHT_VERSION 0
00228 #endif
00229 
00230 /* Always report single error code from recorder routines  */
00231 #ifndef FMSTR_REC_COMMON_ERR_CODES
00232 #define FMSTR_REC_COMMON_ERR_CODES FMSTR_LIGHT_VERSION
00233 #endif
00234 
00235 /* Remove code for single wire communication */
00236 #ifndef FMSTR_SCI_TWOWIRE_ONLY
00237 #define FMSTR_SCI_TWOWIRE_ONLY FMSTR_LIGHT_VERSION
00238 #endif
00239 
00240 /* Number of recorder post-trigger samples is by default controlled by PC */
00241 #ifndef FMSTR_REC_STATIC_POSTTRIG
00242 #define FMSTR_REC_STATIC_POSTTRIG 0
00243 #endif
00244 
00245 /* Recorder divisor is by default controlled by PC */
00246 #ifndef FMSTR_REC_STATIC_DIVISOR
00247 #define FMSTR_REC_STATIC_DIVISOR 0
00248 #endif
00249 
00250 /* Enable Floating point support in Recorder triggering */
00251 #ifndef FMSTR_REC_FLOAT_TRIG
00252 #define FMSTR_REC_FLOAT_TRIG 0
00253 #endif
00254 
00255 /* check recorder settings */
00256 #if FMSTR_USE_RECORDER || FMSTR_USE_FASTREC
00257     
00258     /* 0 means recorder time base is "unknown" */
00259     #ifndef FMSTR_REC_TIMEBASE
00260     #define FMSTR_REC_TIMEBASE 0 
00261     #endif
00262     
00263     /* default recorder buffer size is 256 */
00264     #ifndef FMSTR_REC_BUFF_SIZE
00265     #define FMSTR_REC_BUFF_SIZE 256
00266     #endif
00267 
00268 #endif  
00269 /* default app.cmds settings */
00270 #ifndef FMSTR_USE_APPCMD
00271 #define FMSTR_USE_APPCMD 0
00272 #endif
00273 
00274 #ifndef FMSTR_APPCMD_BUFF_SIZE
00275 #define FMSTR_APPCMD_BUFF_SIZE 16
00276 #endif
00277 
00278 #ifndef FMSTR_MAX_APPCMD_CALLS
00279 #define FMSTR_MAX_APPCMD_CALLS 0
00280 #endif
00281 
00282 /* TSA configuration check */
00283 #ifndef FMSTR_USE_TSA
00284 #define FMSTR_USE_TSA 0
00285 #endif
00286 
00287 #ifndef FMSTR_USE_TSA_SAFETY
00288 #define FMSTR_USE_TSA_SAFETY 0
00289 #endif
00290 
00291 /* TSA table allocation modifier */
00292 #ifndef FMSTR_USE_TSA_INROM
00293 #define FMSTR_USE_TSA_INROM 0
00294 #endif
00295 
00296 #if FMSTR_USE_TSA_INROM
00297 #define FMSTR_TSA_CDECL const
00298 #else
00299 #define FMSTR_TSA_CDECL 
00300 #endif
00301 
00302 /* SFIO not used by default */
00303 #ifndef FMSTR_USE_SFIO
00304 #define FMSTR_USE_SFIO 0
00305 #endif
00306 
00307 /* use transport "pipe" functionality */
00308 #ifndef FMSTR_USE_PIPES
00309 #define FMSTR_USE_PIPES 0
00310 #endif
00311 
00312 /* "pipe" putstring formatting (enabled by default) */
00313 #ifndef FMSTR_USE_PIPE_PRINTF
00314 #define FMSTR_USE_PIPE_PRINTF 1
00315 #endif
00316 
00317 /* "pipe" variable-argument printf (enabled by default) */
00318 #ifndef FMSTR_USE_PIPE_PRINTF_VARG
00319 #define FMSTR_USE_PIPE_PRINTF_VARG FMSTR_USE_PIPE_PRINTF
00320 #endif
00321 
00322 #if FMSTR_USE_PIPES
00323     /* one pipe by default */    
00324     #ifndef FMSTR_MAX_PIPES_COUNT
00325     #define FMSTR_MAX_PIPES_COUNT 1
00326     #endif
00327 
00328     /* pipe printf buffer */    
00329     #ifndef FMSTR_PIPES_PRINTF_BUFF_SIZE
00330     #define FMSTR_PIPES_PRINTF_BUFF_SIZE 48
00331     #endif
00332 #endif
00333 
00334 /* what kind of board information structure will be sent? */
00335 #ifndef FMSTR_USE_BRIEFINFO
00336     #if FMSTR_USE_RECORDER
00337         /* recorder requires full info */
00338         #define FMSTR_USE_BRIEFINFO 0
00339     #else
00340         /* otherwise no brief info is enough */
00341         #define FMSTR_USE_BRIEFINFO 1
00342     #endif
00343 #endif
00344 
00345 /* automatic buffer size by default */
00346 #ifndef FMSTR_COMM_BUFFER_SIZE
00347 #define FMSTR_COMM_BUFFER_SIZE 0
00348 #endif
00349 
00350 /* automatic: determine required buffer size based on features enabled */
00351 #if !FMSTR_COMM_BUFFER_SIZE
00352     /* smallest for basic commands (getinfobrief, write/read memory etc.) */
00353     #undef  FMSTR_COMM_BUFFER_SIZE
00354     #define FMSTR_COMM_BUFFER_SIZE 11
00355 
00356     /* full info required */
00357     #if !(FMSTR_USE_BRIEFINFO) && FMSTR_COMM_BUFFER_SIZE < 35
00358     #undef  FMSTR_COMM_BUFFER_SIZE
00359     #define FMSTR_COMM_BUFFER_SIZE 35
00360     #endif
00361 
00362     /* using application commands (must accommodate maximal app.cmd data length) */
00363     #if FMSTR_USE_APPCMD && FMSTR_COMM_BUFFER_SIZE < ((FMSTR_APPCMD_BUFF_SIZE)+1)
00364     #undef  FMSTR_COMM_BUFFER_SIZE
00365     #define FMSTR_COMM_BUFFER_SIZE ((FMSTR_APPCMD_BUFF_SIZE)+1)
00366     #endif
00367 
00368     /* configuring scope (EX) */
00369     #if FMSTR_USE_SCOPE && FMSTR_COMM_BUFFER_SIZE < ((FMSTR_MAX_SCOPE_VARS)*5+1)
00370     #undef  FMSTR_COMM_BUFFER_SIZE
00371     #define FMSTR_COMM_BUFFER_SIZE ((FMSTR_MAX_SCOPE_VARS)*5+1)
00372     #endif
00373 
00374     /* configuring recorder (EX) */
00375     #if FMSTR_USE_RECORDER && FMSTR_COMM_BUFFER_SIZE < ((FMSTR_MAX_REC_VARS)*5+18)
00376     #undef  FMSTR_COMM_BUFFER_SIZE
00377     #define FMSTR_COMM_BUFFER_SIZE ((FMSTR_MAX_REC_VARS)*5+18)
00378     #endif
00379 
00380     /* SFIO encapsulation (in buffer) */
00381     #if FMSTR_USE_SFIO
00382     #if FMSTR_COMM_BUFFER_SIZE < ((SFIO_MAX_INPUT_DATA_LENGTH)+1)
00383     #undef  FMSTR_COMM_BUFFER_SIZE
00384     #define FMSTR_COMM_BUFFER_SIZE ((SFIO_MAX_INPUT_DATA_LENGTH)+1)
00385     #endif
00386     #endif
00387     
00388     /* SFIO encapsulation (out buffer) */
00389     #if FMSTR_USE_SFIO
00390     #if FMSTR_COMM_BUFFER_SIZE < ((SFIO_MAX_OUTPUT_DATA_LENGTH)+1)
00391     #undef  FMSTR_COMM_BUFFER_SIZE
00392     #define FMSTR_COMM_BUFFER_SIZE ((SFIO_MAX_OUTPUT_DATA_LENGTH)+1)
00393     #endif
00394     #endif
00395     
00396 #endif
00397 
00398 #endif /* __FREEMASTER_DEF_CFG_H */